<template>
	<view class="my-search-container" :style="{ 'background-color': bgColor }" @click="searchBoxHandler">
		<view class="my-search-box" :style="{ 'border-radius': radius + 'px' }">
			<uni-icons type="search" size="18"></uni-icons>
			<text class="placeholder">搜索</text>
		</view>
	</view>
</template>

<script>
export default {
	name: 'WxShopsIndex',
	props: {
		// 背景颜色
		bgColor: {
			default: '#c00000',
			type: String,
		},
		// 圆角尺寸
		radius: {
			default: 18, //单位为px
			type: Number,
		},
	},
	data() {
		return {};
	},

	onLoad() {
		const sysInfo = uni.getSystemInfoSync();
		// 可用高度 = 屏幕高度 - navigationBar高度 - tabBar高度 - 自定义的search组件高度
		this.wh = sysInfo.windowHeight - 50;
	},

	methods: {
		searchBoxHandler() {
			this.$emit('onSearch');
		},
	},
};
</script>

<style lang="less" scoped>
.my-search-container {
	display: flex;
	align-items: center;
	height: 50px;
	padding: 0 10px;
	// background-color: #c00000;
	.my-search-box {
		display: flex;
		justify-content: center;
		align-items: center;
		height: 36px;
		width: 100%;
		background-color: #ffffff;
		border-radius: 15px;
		.placeholder {
			font-size: 15px;
			margin-left: 5px;
		}
	}
}
</style>
